﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using ComicIsland.Common.Entities.InterfaceJson;

/**
 * 创建时间：2014/12/15 17:29:02
 * 作者：yong.blackcore
 * Email：itblackhole@outlook.com
 * QQ：50404503
 */
namespace ComicIsland.Common.Entities
{
    [DataContract]
    public class DownloadComic
    {
        [DataMember]
        public int ComicId { get; set; }

        [DataMember]
        public string ComicTitle { get; set; }

        [DataMember]
        public string CoverUrl { get; set; }

        [DataMember]
        public System.Collections.ObjectModel.ObservableCollection<DownloadComicChapter> Chapters { get; set; }

        [DataMember]
        public int DownloadStatus { get; set; }

        /// <summary>
        /// 总下载数
        /// </summary>
        [DataMember]
        public int Total { get; set; }

        /// <summary>
        /// 已下载数
        /// </summary>
        [DataMember]
        public int TotalCompleted { get; set; }
    }

    [DataContract]
    public class DownloadComicChapter
    {
        [DataMember(Name = "sourceparturl")]
        public string Sourceparturl { get; set; }

        [DataMember(Name = "msourceparturl")]
        public string Msourceparturl { get; set; }

        [DataMember(Name = "partsize")]
        public double Partsize { get; set; }

        [DataMember(Name = "part_id")]
        public int PartId { get; set; }

        [DataMember(Name = "partnumber")]
        public int Partnumber { get; set; }

        [DataMember(Name = "name")]
        public string Name { get; set; }

        [DataMember(Name = "totalpage")]
        public int Totalpage { get; set; }


        [DataMember]
        public int ComicId { get; set; }

        /// <summary>
        /// ComicId#PartId
        /// </summary>
        [DataMember]
        public string ComicIdAndPartId { get; set; }

        [DataMember]
        public int DownloadStatus { get; set; }

        [DataMember]
        public System.Collections.ObjectModel.ObservableCollection<DownloadComicChapterImage> Images { get; set; }
    }

    [DataContract]
    public class DownloadComicChapterImage
    {
        [DataMember]
        public int ComicId { get; set; }

        [DataMember(Name = "part_id")]
        public int PartId { get; set; }

        [DataMember]
        public int DownloadStatus { get; set; }

        [DataMember]
        public string Referer { get; set; }

        [DataMember]
        public string ImageUrl { get; set; }
    }

    /// <summary>
    /// 章节下载状态
    /// </summary>
    public enum DownloadComicChapterStatus
    {
        /// <summary>
        /// 等待
        /// </summary>
        Pending = 10,
        /// <summary>
        /// 正在下载
        /// </summary>        
        Downloading = 20,
        /// <summary>
        /// 已完成
        /// </summary>
        Completed = 30,
        /// <summary>
        /// 错误
        /// </summary>
        ErrorUnknow = 100,
        /// <summary>
        /// 未找到章节下的图片列表
        /// </summary>
        ErrorEmptyImageList = 110,
    }
}
